﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Share/Index.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<% 
    string v = (Request["v"] == null ? "0" : Request["v"].ToString());
%>
<script language="javascript" type="text/javascript">
    $(function () {
        $("input[value=<%=v %>]").attr("checked","true");
        $("input[name=g]").click(function () {
            window.location.href = "/report/bookreport.html?v=" + $(this).val();
        });

    })
</script>

<div style="margin-top:20px;"><input type="radio" name="g" value="0" checked />按语种<input type="radio" name="g" value="1"  />按图书状态<input type="radio" name="g" value="2"  />按图书附件<input type="radio" name="g" value="3"  />按适读年龄<input type="radio" name="g" value="4"  />按级别<input type="radio" name="g" value="5"  />按类型</div>
   <table  id="mainTable" cellspacing="0">
   <caption>图书统计</caption>
           <tr>
            <th>
                分类名称
            </th>
            <th>总价格</th>
            <th>多少种书</th>
            <th>数量</th>
            <th>借书次数</th>
            <th>当前借出量</th>
           </tr>
        <tbody name="mainlist">
        <%
            BIZ.ReportOper ro = new BIZ.ReportOper();
            IList li = ro.getBookReport(v);
            decimal zj=0;
            int sl = 0;
            int times = 0;
            int ccount = 0;
            int lbidCount=0;
            foreach (Hashtable tb in li)
            {
                zj += decimal.Parse(tb["zj"].ToString());
                sl += int.Parse(tb["sl"].ToString());
                lbidCount += int.Parse(tb["lbidCount"].ToString());
                times += int.Parse(tb["jscs"].ToString());
                ccount += int.Parse(tb["dqjcl"].ToString());
        %>
        <tr>
        <% 
                if (v == "5")
                {
                    Response.Write("<td>"+Enum.GetName(typeof(DAL.Enums.bookType), int.Parse(tb["lb_bookType"].ToString()))+"</td>");//类型lb_bookType
                }
                else if (v == "4")
                {
                    Response.Write("<td>"+Enum.GetName(typeof(DAL.Enums.boollevel), int.Parse(tb["lb_level"].ToString()))+"</td>");//级别lb_level
                }
                else if (v == "3")
                {
                    Response.Write("<td>"+Enum.GetName(typeof(DAL.Enums.bookforAge), int.Parse(tb["lb_forAge"].ToString()))+"</td>");//适读年龄lb_forAge
                }
                else if (v == "2")
                {
                    Response.Write("<td>"+(int.Parse(tb["lb_aboutCd"].ToString())==0?"无CD":"有CD")+","+(int.Parse(tb["mp3"].ToString())==0?"无音频":"有音频")+","+(int.Parse(tb["eb"].ToString())==0?"无电子书":"有电子书")+"</td>");//按图书附件（有CD图书、有音频图书、有音频电子书）lb_aboutCd,mp3,eb 
                }
                else if (v == "1")
                {
                    Response.Write("<td>"+Enum.GetName(typeof(DAL.Enums.bookebook), int.Parse(tb["lb_ebook"].ToString()))+"</td>");//图书状态lb_ebook
                }
                else
                {
                    Response.Write("<td>"+Enum.GetName(typeof(DAL.Enums.booklanguage), int.Parse(tb["lb_language"].ToString()))+"</td>");//语种lb_language
                }
            
        %>
        <td><%=Math.Round(decimal.Parse(tb["zj"].ToString()), 2)%></td>
        <td><%=tb["lbidCount"]%></td>
        <td><%=tb["sl"]%></td>
        <td><%=tb["jscs"]%></td>
        <td><%=tb["dqjcl"]%></td>
        </tr>
        <% 
            }    
        %>
        <tr><td colspan="6" style="height:20px;"></td></tr>
        <tr>
        <td>总计</td>
        <td><%=Math.Round(zj,2) %></td>
        <td><%=lbidCount%></td>
        <td><%=sl %></td>
        <td><%=times%></td>
        <td><%=ccount%></td>
        </tr>
        </tbody>
    </table>

</asp:Content>
